package com.lbb.utils.recycler

import android.view.View
import android.view.ViewGroup

abstract class BaseViewModelAdapter<T> : BaseStateAdapter<BaseViewHolder>() {

    var list: List<T> =  mutableListOf()
        set(value) {
            if (value.isNullOrEmpty()) {
                state = TYPE_EMPTY
            } else {
                field = value
                state = TYPE_CONTENT
            }
        }

    protected abstract fun getView(parent: ViewGroup): View

    override fun getItemSize(): Int {
            return list.size
    }

    override fun onCreateHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
        return BaseViewHolder(getView(parent))
    }

}